package com.dk.controller;

import com.dk.data.Result;
import com.dk.service.IDtGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("goods")
@Api("商品审核")
public class GoodsController {

    @Autowired
    private IDtGoodsService goodsService;

    @PostMapping("updateStatus")
    @ApiOperation(value = "根据id修改商品审核状态")
    //参数类型：paramType body表示@RequestBody接收的参数，path表示路径传参/{xx},query表示@RequestParam接受的参数
    @ApiImplicitParams({
            @ApiImplicitParam(name="id",value = "商品id",required = true,paramType = "query"),
            @ApiImplicitParam(name="status",value = "审核状态",required = true,paramType = "query")
    })
    public Result updateStatus(@RequestParam("id") Long id, @RequestParam("status") Integer status){
        goodsService.updateStatus(id,status);
        return Result.ok();
    }
}
